
import UIKit
import Moya

enum MYGSurgicalApi {
    case getSurgicalList(params: [String: Any])
    case getSurgicalDetail(id: String)
    case deleteSurgical(id: String)
    case myHuanzhe(params:[String:Any])
    case addSurgicla(params:[String:Any])
    case patientCaseList(params:[String:Any])
    case patientCaseDetail(params:[String:Any])
    case getInviteStr(params:[String:Any])
    case getInviteQRStr(params:[String:Any])

}

extension MYGSurgicalApi: MYGTargetType {
    var params: [String : Any] {
        switch self {
        case let .getInviteQRStr(params):
            return params
        case .deleteSurgical:
            return ["" : ""]
        case .getSurgicalDetail:
            return ["" : ""]
        case let .getSurgicalList(params):
            return params
        case let .myHuanzhe(params):
            return params
        case let .addSurgicla(params):
            return params
        case let .patientCaseList(params):
            return params
        case let .patientCaseDetail(params):
            return params
        case let .getInviteStr(params):
            return params
        }
    }
    
    var path: String {
        switch self {
        case .getInviteQRStr:
            "/api/doctor/add_patient_qr"
        case .deleteSurgical(let id):
            "/api/doctor/operations/\(id)"
        case .getSurgicalDetail(let id):
            "/api/doctor/operations/\(id)"
        case .getSurgicalList:
            "/api/doctor/operations"
        case .myHuanzhe:
            "/api/im/my_patients"
        case .addSurgicla:
            "/api/doctor/operations"
        case .patientCaseList:
            "/api/patient/case_clamp_list"
        case .patientCaseDetail:
            "/api/patient/get_case_clamp_info"
        case .getInviteStr:
            "/api/im/add_friend_qr"
        }
    }
    
    var method: Moya.Method {
        switch self {
        case .getSurgicalList,.myHuanzhe,.patientCaseList,.patientCaseDetail,.getInviteStr,.getSurgicalDetail,.getInviteQRStr:
            .get
        case .addSurgicla:
                .post
        case .deleteSurgical:
                .delete
        }
    }
    
//    var baseURL: URL {
//        switch self {
//        case .getSurgicalList,.myHuanzhe,.patientCaseList,.patientCaseDetail:
//            return  URL(string: "http://47.93.150.30:8081")!
//        case
//                .addSurgicla:
//            return  URL(string: "http://47.93.150.30:8083")!
//        }
//    }
    
}
